﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace MossmanMill.Controller
{
    /// <summary>
    /// Report Factory Class
    /// </summary>
    /// <dates>
    /// 22/05/2012 - created by Chiaki Sato
    /// </dates>
    class ReportFactory : IReportFactory
    {
        public const string CLASS_TYPE_REPORT = "Report";
        
        private const string ERR_MESSAGE_CLASS_NOT_FOUND = "Report Factory cannot create: {0} class";

        /// <summary>
        /// Constructor
        /// </summary>
        public ReportFactory() 
        {
        }

        /// <summary>
        /// Make each Report class
        /// </summary>
        /// <param name="name">Report type name</param>
        /// <param name="reportFileName">Report file name</param>
        public IReportManager Make(string name, string reportFileName)
        {
            IReportManager iReportManager = null;

            switch (name)
            {

                // Create Report Manager class
                case CLASS_TYPE_REPORT:
                    iReportManager = new ReportManager(reportFileName);
                    return iReportManager;

                default:
                    throw new Exception(String.Format(ERR_MESSAGE_CLASS_NOT_FOUND, name));
            }
        }
    }
}
